<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta charset="UTF-8">
	<title>新增活动</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />

 <!-- 新模板 -->
<link rel="shortcut icon" href="<c:url value='/template/new_muban/images/favicon.ico'/>" type="image/x-icon"/>

<!-- 最新导入 -->
<script type="text/javascript" src="<c:url value='/template/new_muban/js/jquery-min-1.7.js'/>"></script>
<link rel="stylesheet" href="<c:url value='/template/new_muban/css/font.css'/>">
<link rel="stylesheet" href="<c:url value='/template/new_muban/css/xadmin.css'/>">   
<script src="<c:url value='/template/new_muban/lib/layui/layui.js'/>" charset="utf-8"></script> 
<script type="text/javascript" src="<c:url value='/template/new_muban/js/xadmin.js'/>"></script>

 <!-- 富文本编辑器 -->
<script type="text/javascript" charset="utf-8" src="<c:url value='/ue/ueditor.config.js'/>"></script>
<script type="text/javascript" charset="utf-8" src="<c:url value='/ue/ueditor.all.js'/>"> </script>

<style type="text/css">
	/*圆形头像  */
	/* #divcss5{ margin:10px auto}  */
	#divcss5 img{ border-radius:50%} 
	.x-so input.layui-input {
    	width: 150px;
	}
</style>
<style>
.layui-upload-img {
	width: 92px;
	height: 92px;
	margin: 0 10px 10px 0;
}
</style>
<style type="text/css">
.uploader-list {
	margin-left: -15px;
}

.uploader-list .info {
	position: relative;
	margin-top: -25px;
	background-color: black;
	color: white;
	filter: alpha(Opacity = 80);
	-moz-opacity: 0.5;
	opacity: 0.5;
	width: 100px;
	height: 25px;
	text-align: center;
	display: none;
}

.uploader-list .handle {
	position: relative;
	background-color: black;
	color: white;
	filter: alpha(Opacity = 80);
	-moz-opacity: 0.5;
	opacity: 0.5;
	width: 100px;
	text-align: right;
	height: 18px;
	margin-bottom: -18px;
	display: none;
}

.uploader-list .handle i {
	margin-right: 5px;
}

.uploader-list .handle i:hover {
	cursor: pointer;
}

.uploader-list .file-iteme {
	margin: 12px 0 0 15px;
	padding: 1px;
	float: left;
}
</style>
</head>
<body>
   
     <div class="x-body">
     
     
         <form class="layui-form"> 
 
          <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>活动名称
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="title1" name="title1"  placeholder="请输入活动名称" maxlength="64" required="" lay-verify="required"
                  autocomplete="off" class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>副标题
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="title2" name="title2"  placeholder="请输入副标题" maxlength="64" required="" lay-verify="required"
                  autocomplete="off" class="layui-input">
              </div>
          </div>
       <!--   <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>排序
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="orderid" name="orderid" value="0" placeholder="请输入排序值,数大在前" maxlength="4" required="" lay-verify="required"
                  autocomplete="off" class="layui-input"  onkeyup="this.value=this.value.replace(/\D/g,'');">
              </div>
          </div> -->
          
          <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>原价
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="old_price" name="old_price" required="" lay-verify="required"   onkeyup="clearNoNum(this)"
                  autocomplete="off" class="layui-input" placeholder="请输入原价" maxlength="10">
              </div>
         
          </div>
          <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>销售价
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="new_price" name="new_price" required="" lay-verify="required"   onkeyup="clearNoNum(this)"
                  autocomplete="off" class="layui-input" placeholder="请输入销售价" maxlength="10">
              </div>
         
          </div>
          <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>用户返佣
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="rebate" name="rebate" required="" lay-verify="required"   onkeyup="clearNoNum(this)"
                  autocomplete="off" class="layui-input" placeholder="请输入返佣金额" maxlength="10">
              </div>
         
          </div>
          <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>商铺返佣
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="rebate2" name="rebate2" required="" lay-verify="required"   onkeyup="clearNoNum(this)"
                  autocomplete="off" class="layui-input" placeholder="请输入返佣金额" maxlength="10">
              </div>
         
          </div>
          
            <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>城市
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="city" name="city"  placeholder="请输入城市" maxlength="10" required="" lay-verify="required"
                  autocomplete="off" class="layui-input">
              </div>
          </div>
          
          
          
          
         <!--  <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  营业时间
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="service_time" name="service_time"  placeholder="请输入营业时间" maxlength="32"
                  autocomplete="off" class="layui-input">
              </div>
          </div> -->
       <!--    <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>地址
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="business_address" name="business_address"  placeholder="请输入商铺地址" maxlength="32" required="" lay-verify="required"
                  autocomplete="off" class="layui-input">
              </div>
          </div> -->
  <div class="layui-form-item" >
		    <label for="L_username" class="layui-form-label"><span class="x-red">*</span>活动开始/结束日期</label>
		    <div class="layui-input-block">
		    	<input type="text" name="hd_date" class="layui-input" id="hd_date"  readonly="readonly"  lay-verify="required">
					<input type="hidden" class="layui-input" id="starttime"  name="starttime"> <!-- &nbsp;&nbsp;&nbsp;&nbsp; -->
					<input type="hidden" class="layui-input" id="endtime" name="endtime"> <!-- &nbsp;&nbsp;&nbsp;&nbsp; -->
		    </div> 
		  </div> 
  	<div class="layui-form-item layui-form-text">
			<label for="desc" class="layui-form-label"> <span
				class="x-red">*</span>首页小图
			</label>
			<div class="layui-input-inline">
			<input type="hidden" id="image1" lay-verify="required">
				<button type="button" class="layui-btn" id="image1_btn">上传图片</button>
				<div class="layui-upload-list">
					<img class="layui-upload-img" id="image1_demo" src="">
					<p id="image1_demoText"></p>
				</div>
			</div>
		</div>
		<div class="layui-form-item layui-form-text">
			<label for="desc" class="layui-form-label"> <span
				class="x-red">*</span>背景图
			</label>
			<div class="layui-input-inline">
				<input type="hidden" id="image2" lay-verify="required">
				<button type="button" class="layui-btn" id="image2_btn">上传图片</button>
				<div class="layui-upload-list">
					<img class="layui-upload-img" id="image2_demo" src="">
					<p id="image2_demoText"></p>
				</div>
			</div>
			 <div class="layui-form-mid layui-word-aux">
                  <span class="x-red">*</span>海报推荐尺寸 : 1045 * 1503 
              </div>
		</div>
		
		<div class="layui-form-item layui-form-text">
			<label for="desc" class="layui-form-label"> <span
				class="x-red">*</span>背景音乐
			</label>
			<div class="layui-input-block">
				<button type="button" class="layui-btn" id="test6"><i class="layui-icon"></i>上传音频</button> 
			 <input type="text" id="music" name="music"  placeholder="请上传背景音乐" readonly="readonly"  required="" lay-verify="required"
                  autocomplete="off" class="layui-input">
			<!-- <input type="text" id="" lay-verify="required"> -->
			</div>
	</div>		
	 <%--  	<div class="layui-form-item layui-form-text">
			<label for="desc" class="layui-form-label"> 
				<span class="x-red">*</span>轮播图
			</label>
			<div class="layui-input-block">
				<div class="layui-upload">
					<button type="button" class="layui-btn" id="test2">多图上传</button>
					<blockquote class="layui-elem-quote layui-quote-nm"
						style="margin-top: 10px; width: 88%">
						预览图：
						<div class="layui-upload-list uploader-list" style="overflow: auto;"
							id="uploader-list">
							<c:forTokens items="${supplyDetails.banner}" delims="," var="banner">  
						         
							 <div id="" class="file-iteme">
							 <div class="handle"><i class="layui-icon layui-icon-delete"></i></div>
							 	<img style="width: 100px;height: 100px;" src="<c:out value="${banner}"/>">
									<div class="info"></div>
							</div>
						    </c:forTokens> 
	                    
							
						</div>
					</blockquote>
				</div>
			
			</div>
		</div> --%>
  	
  		<div class="layui-form-item layui-form-text">
              <label for="desc" class="layui-form-label">
          <span class="x-red">*</span>活动规则
              </label>
              <div class="layui-input-block" >
               	<script id="editor" type="text/plain" style="width:100%;height:500px;"></script>
              </div>
           </div>
		
		</div>
	  
	  </div>
	</div> 
  
  
  
          
          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
              </label>
              <button  class="layui-btn" lay-filter="add" lay-submit="">
                 新增
              </button>
          </div>
      </form>
    </div>
    
    
  
    <script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        
        //执行一个laydate实例
        laydate.render({
          elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
          elem: '#end' //指定元素
        });
        //执行一个laydate实例
        laydate.render({
      	  type: 'time'
      		    ,format: 'HH:mm:ss'
          ,elem: '#end_time' //指定元素
        });
        
        
        //执行一个laydate实例
  	  laydate.render({
  	    elem: '#hd_date' //指定元素  
  	   ,range: true
  	   ,type: 'datetime'
  	  });
  	  laydate.render({
    	    //指定元素
    	   	elem: '#hx_date'
    	   ,range: true
    	   ,type: 'datetime'
    	  });  
      });
        layui.use(['form','layer'], function(){
            $ = layui.jquery;
          var form = layui.form
          ,layer = layui.layer;
          
          
          
        
          //自定义验证规则
          form.verify({
            nikename: function(value){
              if(value.length < 5){
                return '昵称至少得5个字符啊';
              }
            }
            ,pass: [/(.+){6,12}$/, '密码必须6到12位']
            ,repass: function(value){
                if($('#L_pass').val()!=$('#L_repass').val()){
                    return '两次密码不一致';
                }
            }
          });

          var flag = "A";
          form.on('radio(ho_type)', function(data){
			    //console.log(data.elem); //得到radio原始DOM对象
			    console.log(data.value); //被点击的radio的value值
			     if(data.value==0){
			     	    flag = "B";
			     }
			   
			     
			}); 
          
          var ho_bx_flag = "A";
          form.on('radio(ho_bx)', function(data){
			    //console.log(data.elem); //得到radio原始DOM对象
			    console.log(data.value); //被点击的radio的value值
			     if(data.value==1){
			    	 ho_bx_flag = "B";
			     }
			   
			     
			}); 

          
          
          
          //监听提交
          form.on('submit(add)', function(data){
           
           //标题1
             var title1 = $("#title1").val();
           //标题2
             var title2 = $("#title2").val();
           //城市
             var city = $("#city").val();
           //首页小图
           var image1 = $("#image1").val();
           //背景图
           var image2 = $("#image2").val();
          
           //轮播图
        /*    
			if ($(".file-iteme").length < 1) {
				   layer.msg('上传图片不能少于1张!',{icon: 2,time:3000});   
					return false;
			 }
			if ($(".file-iteme").length > 5) {
				   layer.msg('上传图片不能多于5张!',{icon: 2,time:3000});   
					return false;
			 }
	
			//轮播图
			 var banner = images.toString(); */
           
          
             //原价值
            var old_price = $("#old_price").val();
           
            if(old_price == '' || old_price==null){
            	old_price = 0;
            }
         //售价
            var new_price = $("#new_price").val();
           
            if(new_price == '' || new_price==null){
            	new_price = 0;
            }
            //返利
            var rebate = $("#rebate").val();
           
            if(rebate == '' || rebate==null){
            	rebate = 0;
            }
            var rebate2 = $("#rebate2").val();
            
            if(rebate2 == '' || rebate2==null){
            	rebate2 = 0;
            }
            
            
       //时间
            var hd_date = $("#hd_date").val();
         
            var rule = UE.getEditor('editor').getContent();
	         if(rule == "" || rule == null){
	        	  layer.msg('请输入活动规则!',{icon: 2,time:3000});      
		      	  return false; 
	         } 
           
	         
	         //音频
	         var music = $("#music").val();
        	 
        //	return false;
        	  $.ajax({
	                type: 'POST',
	                url: "<c:url value='/addLMActivity.do'/>",
			     	async : false, // 注意此处需要yi步  
		    		data: {
		 	   			"title1":title1,"title2":title2,"city":city,"image1":image1,"image2":image2,"old_price":old_price
		 	   		,"new_price":new_price,"rebate":rebate,"hd_date":hd_date,"rule":rule,"rebate2":rebate2
		 	   		,"music":music
		    		},
			        success: function(data){		
						if (data == 0) {
		             	   layer.msg('新增失败!',{icon: 2,time:3000});      
		                    return false;
		                } else if(data ==1)  {
		
		                	  layer.msg("新增成功", {icon: 6,time:1000},function () {
		                          // 获得frame索引
		                          var index = parent.layer.getFrameIndex(window.name);
		                          //alert(index);
		                          //关闭当前frame
		                          parent.layer.close(index);
		                          //重新加载父页面
		                          parent.location.reload();
		                      });
				           }
	             
	                }
				});
        	
            return false;
          });
          
          
        });
    </script>
     <script type="text/javascript">
//小数验证
	function clearNoNum(obj){  
     //修复第一个字符是小数点 的情况.  
     if(obj.value !=''&& obj.value.substr(0,1) == '.'){  
         obj.value="";  
     }  
     obj.value = obj.value.replace(/^0*(0\.|[1-9])/, '$1');//解决 粘贴不生效  
     obj.value = obj.value.replace(/[^\d.]/g,"");  //清除“数字”和“.”以外的字符  
     obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个. 清除多余的       
     obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");      
     obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');//只能输入两个小数       
     if(obj.value.indexOf(".")< 0 && obj.value !=""){//以上已经过滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额  
         if(obj.value.substr(0,1) == '0' && obj.value.length == 2){  
             obj.value= obj.value.substr(1,obj.value.length);      
         }  
     }      
 }    
 </script>  
 
<script type="text/javascript">
//多图容器 【注册全局变量】
var images = [];

layui.use('upload', function(){
	  var $ = layui.jquery
	  ,upload = layui.upload;

	//多图片上传
	var uploadInst = upload.render({
		elem: '#test2'
            ,url: "<c:url value='/uploadToQiNiu.do'/>"
            ,multiple: true
            ,before: function(obj){
                layer.msg('图片上传中...', {
                    icon: 16,
                    shade: 0.01,
                    time: 0
                })
            }
            ,done: function(res){
            	//console.log(res);
            	//console.log(res.file_url);
                layer.close(layer.msg());//关闭上传提示窗口
                var title = res.file_url;
                var i1 = title.lastIndexOf("_"); //3
                title = title.substr(i1 +1);
                
                if ($(".file-iteme").length >=5) {
            		return layer.msg('上传图片不能多于5张！');
				  }else{
					  
	                //上传完毕
	                $('#uploader-list').append(
	                    '<div id="" class="file-iteme">' +
	                    '<div class="handle"><i class="layui-icon layui-icon-delete"></i></div>' +
	                    '<img style="width: 100px;height: 100px;" src='+ res.file_url +'>' +
	                    '<div class="info">' + title + '</div>' +
	                    '</div>'
	                    
	                );
	                  //追加图片成功追加文件名至图片容器
	                    images.push(res.file_url);
				 }
                
            }
	});
	
	
	
	
	
	
	/* 单图  */
	 upload.render({
		    elem: '#image1_btn'
	 	   ,url: '<%=request.getContextPath()%>/uploadToQiNiu.do'
	 	   ,auto:true
	 	,size: 1024//限制文件大小，单位 KB
	 	   ,exts: 'jpg|png'
	 	   ,xhr:xhrOnProgress
	 	   ,progress:function(value){//上传进度回调 value进度值
	 	     console.log(value);
	 	     element.progress('demo', value+'%')//设置页面进度条
	 	    }
	 	   //,bindAction: '#test-upload-change-action'
	 	   ,before: function(obj){
	 	   //返回的参数item，即为当前的input DOM对象
	 	     layer.load(); //上传loading
	 	       console.log('文件上传中');
	 	 
	 	     //预读本地文件示例，不支持ie8
	 	     obj.preview(function(index, file, result){
	 	       $('#image1_demo').attr('src', result); //图片链接（base64）
	 	     });
	 	 
	 	   }
	 	   ,done: function(res){
	 	     console.log("返回码 : "+res.code);
	 		
	  		 //如果上传失败
	 	      if(res.code != 200){
	 	        return layer.msg('上传失败');
	 	      }
	 	     layer.closeAll();
	 	     layer.msg("上传成功");
	 	      //上传成功
	 	      $("#image1").val(res.file_url);
	 		
	 	   },error: function(){
		      //演示失败状态，并实现重传
		      var demoText = $('#image1_demoText');
		      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
		      demoText.find('.demo-reload').on('click', function(){
		        uploadInst.upload();
		      });
		    }

	});
	
	
	 /* 海报单图  */
	 upload.render({
		    elem: '#image2_btn'
	 	   ,url: '<%=request.getContextPath()%>/uploadToQiNiu.do'
	 	   ,auto:true
	 	,size: 1024//限制文件大小，单位 KB
	 	   ,exts: 'jpg|png'
	 	   ,xhr:xhrOnProgress
	 	   ,progress:function(value){//上传进度回调 value进度值
	 	     console.log(value);
	 	     element.progress('demo', value+'%')//设置页面进度条
	 	    }
	 	   //,bindAction: '#test-upload-change-action'
	 	   ,before: function(obj){
	 	   //返回的参数item，即为当前的input DOM对象
	 	     layer.load(); //上传loading
	 	       console.log('文件上传中');
	 	 
	 	     //预读本地文件示例，不支持ie8
	 	     obj.preview(function(index, file, result){
	 	       $('#image2_demo').attr('src', result); //图片链接（base64）
	 	     });
	 	 
	 	   }
	 	   ,done: function(res){
	 	     console.log("返回码 : "+res.code);
	 		
	  		 //如果上传失败
	 	      if(res.code != 200){
	 	        return layer.msg('上传失败');
	 	      }
	 	     layer.closeAll();
	 	     layer.msg("上传成功");
	 	      //上传成功
	 	      $("#image2").val(res.file_url);
	 		
	 	   },error: function(){
		      //演示失败状态，并实现重传
		      var demoText = $('#image2_demoText');
		      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
		      demoText.find('.demo-reload').on('click', function(){
		        uploadInst.upload();
		      });
		    }

	});
	

	 /* 分享单图  */
	 upload.render({
		    elem: '#wepro_qrcode_image_btn'
	 	   ,url: '<%=request.getContextPath()%>/uploadToQiNiu.do'
	 	   ,auto:true
	 	,size: 1024//限制文件大小，单位 KB
	 	   ,exts: 'jpg|png'
	 	   ,xhr:xhrOnProgress
	 	   ,progress:function(value){//上传进度回调 value进度值
	 	     console.log(value);
	 	     element.progress('demo', value+'%')//设置页面进度条
	 	    }
	 	   //,bindAction: '#test-upload-change-action'
	 	   ,before: function(obj){
	 	   //返回的参数item，即为当前的input DOM对象
	 	     layer.load(); //上传loading
	 	       console.log('文件上传中');
	 	 
	 	     //预读本地文件示例，不支持ie8
	 	     obj.preview(function(index, file, result){
	 	       $('#wepro_qrcode_image_demo').attr('src', result); //图片链接（base64）
	 	     });
	 	 
	 	   }
	 	   ,done: function(res){
	 	     console.log("返回码 : "+res.code);
	 		
	  		 //如果上传失败
	 	      if(res.code != 200){
	 	        return layer.msg('上传失败');
	 	      }
	 	     layer.closeAll();
	 	     layer.msg("上传成功");
	 	      //上传成功
	 	      $("#wepro_qrcode_image").val(res.file_url);
	 		
	 	   },error: function(){
		      //演示失败状态，并实现重传
		      var demoText = $('#wepro_qrcode_image_demoText');
		      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
		      demoText.find('.demo-reload').on('click', function(){
		        uploadInst.upload();
		      });
		    }

	});
	
	
	//音频
	 upload.render({
		    elem: '#test6'
		    ,url: '<%=request.getContextPath()%>/uploadToQiNiu.do'
		    ,accept: 'audio' //音频
		    ,done: function(res){
		      console.log(res)
		      $("#music").val(res.file_url);
		    }
		  });
	
});


$(document).on("mouseenter mouseleave", ".file-iteme", function(event){
    if(event.type === "mouseenter"){
        //鼠标悬浮
        $(this).children(".info").fadeIn("fast");
        $(this).children(".handle").fadeIn("fast");
    }else if(event.type === "mouseleave") {
        //鼠标离开
        $(this).children(".info").hide();
        $(this).children(".handle").hide();
    }
});

//删除图片
$(document).on("click", ".file-iteme .handle", function(event){
    
    var  $this = $(this).parent();   //  习惯性保存下当前标签
    var index = $this.index();
    console.info( index );
    
    
    $(this).parent().remove();
	  console.log(images);
  //获取下标
	//var subscript=$("#uploader-list img").index($(this));  
	//console.log("下标  :  "+subscript);
	//删除数组
	images.splice(index, 1);
	//重新排序
	//images.sort();
    console.log(images);
    
});


</script>   
<!-- 图片上传可视化用 -->
<script type="text/javascript">
//该部分代码主要使用ajax的xhr属性，我copy别人的，自己也不会写，应该不用管。

   var xhrOnProgress=function(fun) {
      xhrOnProgress.onprogress = fun; //绑定监听
       //使用闭包实现监听绑
      return function() {
          //通过$.ajaxSettings.xhr();获得XMLHttpRequest对象
          var xhr = $.ajaxSettings.xhr();
           //判断监听函数是否为函数
            if (typeof xhrOnProgress.onprogress !== 'function')
                 return xhr;
             //如果有监听函数并且xhr对象支持绑定时就把监听函数绑定上去
              if (xhrOnProgress.onprogress && xhr.upload) {
                    xhr.upload.onprogress = xhrOnProgress.onprogress;
              }
              return xhr;
       }
   };

// 图片弹出层
layui.use('layer', function(){
    $ = layui.jquery;//jquery
  layer = layui.layer;//弹出层

  //以上模块根据需要引入
	//轮播图弹出
    layer.ready(function(){ //为了layer.ext.js加载完毕再执行
      layer.photos({
        photos: '#x-img'
        //,shift: 5 //0-6的选择，指定弹出图片动画类型，默认随机
      });
    });

}); 
</script>  
<!-- ue初始化 -->
<script type="text/javascript">
	var ue = UE.getEditor('editor',{
		autoFloatEnabled:true,//浮动
		toolbars: [[
    		'source','bold', 'italic',  'removeformat', 'formatmatch', 'autotypeset','selectall', 'cleardoc', 
           'lineheight', '|','fontfamily', 'fontsize', 'forecolor', 'backcolor','|',
            'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|','insertimage', 'emotion', 
        ]]
	});
	
	/* var ue2 = UE.getEditor('editor_pz',{
		autoFloatEnabled:true,//浮动
		toolbars: [[
    		'source','bold', 'italic',  'removeformat', 'formatmatch', 'autotypeset','selectall', 'cleardoc', 
           'lineheight', '|','fontfamily', 'fontsize', 'forecolor', 'backcolor','|',
            'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|','insertimage', 'emotion', 
        ]]
	}); */
	
</script> 
			<!-- ue初始化 -->
<!-- <script type="text/javascript">
	var ue = UE.getEditor('editor1',{
		toolbars: [[
    		'source','bold', 'italic',  'removeformat', 'formatmatch', 'autotypeset','selectall', 'cleardoc', 
           'lineheight', '|','fontfamily', 'fontsize', 'forecolor', 'backcolor','|',
            'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|','insertimage', 'emotion', 'insertvideo'
        ]]
    });
</script>  -->     
  </body>
</html>